﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        int alp = 255;
        Image img;
        bool up;

        public Form1()
        {
            InitializeComponent();
            this.DoubleBuffered = true;
            timer1.Interval = 50;
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            //int a = 15;
            //int full = 255;

            //pictureBox1.Image = global::WindowsFormsApplication1.Properties.Resources._15;
            //pictureBox1.Image = img;
            chosePicture(clickeditem);
            
            textBox1.Text = textBox1.Text + " " + alp;
            Graphics g = Graphics.FromImage(pictureBox1.Image);
            SolidBrush b = new SolidBrush(Color.FromArgb(alp, 0, 0, 0));
            if (up)
            {
                if (alp >= 5)
                {
                    alp -= 5;
                }
                else
                {
                    //timer1.Enabled = false;
                    up = false;
                }
            }
            else
            {
                if (alp < 250)
                {
                    alp += 5;
                }
                else
                {
                    timer1.Enabled = false;
                    //up = false;
                }
            }

            g.FillRectangle(b, 0, 0, 371, 246);
            pictureBox1.Refresh();


            //textBox1.Text = textBox1.Text + " " + alp;


        }
        int clickeditem = 0;

        private void button1_Click(object sender, EventArgs e)
        {
            
            //img = global::WindowsFormsApplication1.Properties.Resources._15;
            timer1.Enabled = true;
            alp = 255;
            up = true;
            textBox1.Text = "";

            clickeditem++;
            //chosePicture(clickeditem);


           img = pictureBox1.Image;

            //pictureBox1.Refresh();
            //alp = 255;
        }

        public void chosePicture(int clickedItem2)
        {
            switch (clickedItem2)
            {
                case 1:
                    pictureBox1.Image = global::WindowsFormsApplication1.Properties.Resources._15;
                    break;
                case 2:
                    pictureBox1.Image = global::WindowsFormsApplication1.Properties.Resources._17;
                    break;
                case 3:
                    pictureBox1.Image = global::WindowsFormsApplication1.Properties.Resources._12;
                    break;
                case 4:
                    pictureBox1.Image = global::WindowsFormsApplication1.Properties.Resources._13;
                    break;
                case 5:
                    pictureBox1.Image = global::WindowsFormsApplication1.Properties.Resources._14;
                    break;
                case 6:
                    pictureBox1.Image = global::WindowsFormsApplication1.Properties.Resources._18;
                    break;
            }
        }

        private void Form1_Paint(object sender, PaintEventArgs e)
        {


        }
/*
        public int GetArgb(int timerInterval, int argbValue)
        {

            for (; timerInterval < 255; timerInterval++)
            {
                if (timerInterval > 100)
                {
                    break;
                }
                else
                {
                    argbValue = argbValue + 2;

                }

            }

            return argbValue;
        }
*/
        private void Form1_Load(object sender, EventArgs e)
        {

        }
    }
}
